package ATM.gui;

import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ScrollPaneConstants;
import javax.swing.table.TableModel;
import java.awt.GridLayout;
import java.awt.FlowLayout;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JButton;

public class ViewBalance extends JPanel {

	Screen screen;
	JButton btnPrevious;
	JButton btn;
	JLabel lblAccountData;
	JLabel lblAvBalData;
	JLabel lblToBalData;
	JLabel lblIntRateData;
	JLabel lblOvDraftData;
	JLabel lblAccountNum;
	JLabel lblAllAccountNum;

	public ViewBalance(Screen screen) {
		this.screen = screen;
		setLayout(null);

		JButton btnPrevious = new JButton("Previous");
		btnPrevious.setActionCommand("PreviousVB");
		btnPrevious.addActionListener(screen.getaL());
		btnPrevious.setBounds(10, 55, 128, 28);
		add(btnPrevious);
		
		JButton btnNext = new JButton("Next");
		btnNext.setActionCommand("NextVB");
		btnNext.addActionListener(screen.getaL());
		btnNext.setBounds(502, 55, 128, 28);
		add(btnNext);

		
		lblAccountNum = new JLabel();
		lblAccountNum.setBounds(257, 69, 26, 14);
		add(lblAccountNum);

		JLabel lblOf = new JLabel("of");
		lblOf.setBounds(305, 69, 26, 14);
		add(lblOf);

		lblAllAccountNum = new JLabel();
		lblAllAccountNum.setBounds(345, 69, 46, 14);
		add(lblAllAccountNum);

	

		JLabel lblAccount = new JLabel("Account:");
		lblAccount.setBounds(152, 151, 150, 14);
		add(lblAccount);

		lblAccountData = new JLabel();
		lblAccountData.setBounds(337, 151, 194, 14);
		add(lblAccountData);

		JLabel lblAvBal = new JLabel("AvailableBalance:");
		lblAvBal.setBounds(152, 176, 150, 14);
		add(lblAvBal);

		lblAvBalData = new JLabel();
		lblAvBalData.setBounds(337, 176, 194, 14);
		add(lblAvBalData);

		JLabel lblToBal = new JLabel("TotalBalance:");
		lblToBal.setBounds(152, 201, 150, 14);
		add(lblToBal);

		lblToBalData = new JLabel();
		lblToBalData.setBounds(337, 201, 194, 14);
		add(lblToBalData);

		JLabel lblOvdraft = new JLabel("Overdraft:");
		lblOvdraft.setBounds(152, 226, 150, 14);
		add(lblOvdraft);

		lblOvDraftData = new JLabel();
		lblOvDraftData.setBounds(337, 226, 194, 14);
		add(lblOvDraftData);

		JLabel lblIntRate = new JLabel("Interest rate:");
		lblIntRate.setBounds(152, 251, 150, 14);
		add(lblIntRate);

		lblIntRateData = new JLabel();
		lblIntRateData.setBounds(337, 251, 194, 14);
		add(lblIntRateData);
		
		JButton btnExitViewBal = new JButton("Exit");
		btnExitViewBal.setActionCommand("ExitViewBal");
		btnExitViewBal.addActionListener(screen.getaL());
		btnExitViewBal.setBounds(502, 356, 128, 28);
		add(btnExitViewBal);
		
		JLabel image = (new JLabel(screen.getVariables().getImage1() ));
		image.setBounds(0, 0, 640, 480);
		add(image);

	}

	public void setTextField(String accType, String avBal, String toBal,
			String rate, String ovDraft, String theAccount, String allAccounts) {
		lblAccountData.setText(accType);
		lblIntRateData.setText(rate);
		lblAvBalData.setText(avBal);
		lblToBalData.setText(toBal);
		lblOvDraftData.setText(ovDraft);
		lblAccountNum.setText(theAccount);
		lblAllAccountNum.setText(allAccounts);

	}
	
}
